<?php

$this->breadcrumbs = array(
	$model->label(2) => array('index'),
	GxHtml::valueEx($model) => array('view', 'id' => GxActiveRecord::extractPkValue($model, true)),
	Yii::t('app', 'Update Video'),
);

$this->menu = array(
	array('label'=>'Back', 'url'=>array($this->backurl),
		'linkOptions'=> array('class' => 'icon icon-arrow-left6 tb-gray'),
	),
);

?>

<h2 class="form-header">
	<?php
	echo CHtml::encode($this->pageTitle);
	?>
</h2>


<div class="form protected-form">

	<?php $form = $this->beginWidget('GxActiveForm', array(
		'id' => 'drillform',
		'enableAjaxValidation' => false,
	));
	?>

	<?php echo $form->errorSummary($model); ?>


	<table class="form-grid">
		<?php
		if($model->youtube_id=="") :
		?>
		<tr>
			<td><label>Youtube URL</label></td>
			<td><input name="youtube_url" type="text" class="input-xxlarge">
			<a onclick="drillform.submit()" class="form-button icon icon-upload3 form-button-icon">Import</a></td>
		</tr>
		<?php
		endif;
		if ($model->youtube_id!="") :
		?>
		<tr>
			<td><label>Youtube ID</label></td>
			<td>
				<input name="remove_video" value="1" type="hidden">
				<?php
					echo $form->textField($model, 'youtube_id', array('class'=>'input-xxlarge','maxlength' => 40, 'disabled'=>'disabled'));
					echo " <a onclick=\"drillform.submit()\" class=\"form-button icon icon-cancel-circle2 form-button-icon\">Remove</a>";
				?>
			</td>
		</tr>
		<tr>
			<td><label>Preview</label></td>
			<td>
				<?php
				echo '<iframe width="500" height="360" src="//www.youtube.com/embed/' . $model->youtube_id . '" frameborder="0" allowfullscreen></iframe>';
				?>
			</td>
		</tr>
		<?php
		endif;
		?>

	</table>

	<?php
	$this->endWidget();
	?>
</div><!-- form -->